<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2023/06/15
  Time: 11:15
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>归还书籍</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="/static/layui/css/layui.css" media="all">
    <script src="/static/layui/layui.js" charset="utf-8"></script>
</head>
<body>


<form class="layui-form   layui-form-pane" action="">
    <!-- 归还图书id -->
    <div class="layui-form-item">
        <label class="layui-form-label">归还图书id</label>
        <div class="layui-input-block">
            <input type="text" name="bookId" value="" required lay-verify="required"
                   placeholder="请输入归还图书id" autocomplete="off" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>

</form>

<script>

    layui.use(['form', 'laydate'], function () {
        // layer.closeAll();
        $ = layui.jquery;
        var form = layui.form
        var laydate = layui.laydate; // 日期选择

        // 监听提交
        form.on('submit(formDemo)', function (data) {
            $.ajax({
                url: '/adminBorrowInfoUpd',
                method: 'post',
                data: data.field, // JSON.stringify(data.field),
                dataType: 'json',
                success: function (data) {
                    if (data.code == "0") {
                        console.log("success")
                        parent.layer.msg("归还成功", {
                            icon: 6,
                            time: 500
                        });
                        setTimeout(function () {
                            var index = parent.layer.getFrameIndex(window.name); // 操作父页面
                            parent.layer.close(index);
                        }, 500);

                    } else {
                        layer.msg("归还失败");
                    }
                }
            })
            return false;
        });
    });

</script>

</body>
</html>
